package com.itheima.dao;

import com.itheima.pojo.Menu;
import com.itheima.pojo.Role;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Set;

public interface MenuDao {

    @Select("select * from t_menu")
    public List<Menu> findAll();

    @Select("select menu_id from t_role r,t_role_menu rm where r.id=rm.role_id and r.id = #{roleId}")
    public Set<Integer> findMenuIds(Integer roleId);

    @Select("select * from t_menu where id = #{menuId}")
    public Menu findById(Integer menuId);

    @Select("select level from t_menu where id = #{menuId}")
    Integer findLevelById(Integer menuId);

    @Select("SELECT * FROM t_menu WHERE parentMenuId = #{menuId}")
    List<Menu> findSonMenu(Integer menuId);

}
